<?php

header("Content-type: application/xhtml+xml");

require_once('../lib/Smarty/Smarty.class.php');
require_once('../lib/HimaShare.php');
require_once('../lib/Schedule.php');
require_once('../lib/Util.php');
require_once('../lib/lib.mobile.php');
require_once('../lib/Config.php');
require_once('../lib/Note.php');
require_once('../lib/Note/List.php');

define('ROWS_PER_PAGE', 10);

$data   = make_page(array_merge($_GET, $_POST));
$smarty = new Smarty();
$smarty->assign($data);
$smarty->display($data['error_code'] ? 'error.tmpl' : 'invited_member.tmpl');

function make_page ($params) {
    $data = array('error_code' => 0);

/*    if (!validate_signature($params)) {
        $data['error_code'] = 1;
        return $data;
    }*/

    $user   = $params['opensocial_owner_id'];
    $app_id = $params['opensocial_app_id'];

    $my_data        = HimaShare::get_member($user);
    $friends        = HimaShare::get_all_friends($user);
    $friends[$user] = $my_data;
	
    $members = explode("," , $params['request_member']);


    $data['owner_id']   = $user;
    $data['schedules']  = $schedule_hash;
    $data['friends']    = $friends;
	$data['url_prefix'] = URL_PREFIX;
	$data['members']    = $members;
	$data['request_member'] =  $params['request_member'];
	$data['date']           =  $params['date'];

    $data['analytics']    = '<img src="' . googleAnalyticsGetImageUrl() . '" />'; // for google analytics

    return $data;
}

?>
